<?php

namespace app\apis\controller;

use think\Controller;

class ResourceController extends Controller
{
    protected function initialize()
    {
        parent::initialize();
        $this->server = model('server.resource');
    }

    public function uploadImgOp()
    {
        $file = request()->file('img_file');
        $responseData['meta'] = ['code' => 1, 'msg' => lang('UPLOAD_SUCCESS')];
        $responseData['data'] = $this->server->uploadImg();

        return $responseData;
    }

    public function setResourceStatusOp()
    {
        $postData = validateRequestParam('resource', 'setResourceStatus');
        $responseData['meta'] = ['code' => 1, 'msg' => lang('SET_SUCCESS')];
        $responseData['data'] = $this->server->setResourceStatus($postData);

        return $responseData;
    }
}
